<style>


</style>
<template>
  <!-- 供应商对账 -->
    <div>
                   <!-- 根据条件查询 -->
    <div>
      <el-form :inline="true"  class="demo-form-inline" ref="ruleForm">
        <el-form-item label="单据编号">
          <el-input v-model="documentNumber" placeholder="请输入单据编号查询"></el-input>
        </el-form-item>
        <el-form-item label="供应商名称">
          <el-input v-model="productName" placeholder="请输入商品信息查询"></el-input>
        </el-form-item>
        <el-form-item label=" 单据日期 ">
          <el-date-picker
            v-model="begintime"
            type="datetimerange"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :default-time="['12:00:00']"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <!-- <el-button type="primary" @click="findByPage">查询</el-button> -->
           <el-button type="primary" plain   @click="findByPage">查询</el-button>
          <el-button @click="resetForm">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <br>


       <!-- table展示 -->
       <div>
         <Table
        border
        
        :columns="columns4"
        :data="data1"
     
      >


      
         <template  slot-scope="scope" slot="types">
          <span >{{scope.row.erpSettlementaccount.accountName}}</span>
        </template>

          <template slot-scope="{ row, index }" slot="action">
          <!-- <Button type="info" size="large"   @click="findSalesOrderByDCNum(row)" >查看</Button> -->
            <el-button type="primary" plain   @click="findSalesOrderByDCNum(row)">查看</el-button>
          
        </template>
      </Table>
    </div>
    <br>

    
     <!-- 分页 -->
    <div style="float:right">
      <Page
        :total="dataCount"
        :page-size="pageSize"
        @on-change="changepage"
        @on-page-size-change="_nowPageSize"
        show-elevator
      />
    </div>
    

      <!-- 根据订单编号查看 -->
    <Modal v-model="findSalseDMNumContent" title="查看" width="1340">
      <Table border ref="selection" :columns="columns5" :data="DMNumList" height="350" >
        <template slot-scope="{ row, index }" slot="resName">{{row.erpWarehouseinformation.resName}}</template>


      
      </Table>
    </Modal>










    </div>


</template>
<script>
import axios from "axios";
export default {
   data() {
      return {
           columns5: [
        {
            title:"#",
            key:"id",
            align:"center",
        },
         {
          title: "单据编号",
          key: "documentsNumber",
          align:"center",
        },
        {
          title:"序列号",
          key:"serialNumber",
          align:"center",
        },
        {
          title: "商品名称",
          key: "productName",
          align:"center",
        },
      
       
        {
          title:"数量",
          key:"number",
          align:"center",
        },
        {
          title:"单价",
          key:"unitPrice",
          align:"center",
        },
         {
          title:"总价",
          key:"totalAmount",
          align:"center",
        },
         {
          title: "仓库",
          slot: "resName",
          align:"center",
        },
        {
          title:"扩展信息",
          key:"extendedInformation",
          align:"center",
        }
       
      ],



            columns4: [
        {
          title: "#",
          key: "id",
          align:"center",
        },
     
        {
          title: "单据编号",
          key: "documentNumber",
          align:"center",
        },
        {
          title: "银行",
          slot: "types",
          align:"center",
        },
        {
          title: "单据日期",
          key: "documentDate",
          align:"center",
        },
        {
            title:"供应商名称",
            key:"fromMoney",
            align:"center",
        },
        {
            title:"单据金额",
            key:"actualPayment",
            align:"center",
        },
        
        {
          title: "实际支付",
          key: "actualPayment",
          align:"center",
        },
        {
            title:"退款金额",
            key:"refund",
            align:"center",
        },
         {title: "operate",
          slot: "action",
          align:"center",
         }

        
      ],
             data1: [],

        spinShow:true,


                   // 分页的条件
      productName: "",
      documentNumber: "",
      begintime: [],


      //分页
        pageSize: 5, //每页显示多少条
      dataCount: 0, //总条数
      pageCurrent: 1, //当前页,
      findSalseDMNumContent:false,
      DMNumList:[]
      }
   },


   created(){
        this.getList();
   },
   methods:{

          // 根据单据编号查询
    findSalesOrderByDCNum(row) {
      axios
        .get(
          "http://localhost:8082/Entercommoditycontent/getEntercommoditycontentByDCNum?documentNumber=" +
            row.documentNumber
        )
        .then(res => {
          this.DMNumList = res.data;
          console.log(this.DMNumList)
          this.findSalseDMNumContent = true;
        });
    },



            changepage(index) {
       axios
        .post(
          "//localhost:8082/Supplierreconciliation/SupplierreconciliationPage?documentNumber=" +
            this.documentNumber +
            "&productName=" +
            this.productName +
            "&time=" +
            this.begintime +
            "&pageSize=" +
            this.pageSize +
            "&pageCurrent=" +
           index
        )
        .then(res => {
          console.log("13123123123213")
          console.log(res.data);
          this.dataCount = res.data.countTotal;
          this.data1 = res.data.list;
         
          //当从数据库获取完毕  关闭加载特效
          this.spinShow=false;
          // this.begintime = "";
        });
    },

    //每页显示的数据条数
    _nowPageSize(index) {
      //实时获取当前需要显示的条数
      this.pageSize = index;
    },


       getList(){
        axios
        .post(
          "//localhost:8082/Supplierreconciliation/SupplierreconciliationPage?documentNumber=" +
            this.documentNumber +
            "&productName=" +
            this.productName +
            "&time=" +
            this.begintime +
            "&pageSize=" +
            this.pageSize +
            "&pageCurrent=" +
            this.pageCurrent
        )
        .then(res => {
          console.log("13123123123213")
          console.log(res.data);
          this.dataCount = res.data.countTotal;
          this.data1 = res.data.list;
         
          //当从数据库获取完毕  关闭加载特效
          this.spinShow=false;
          // this.begintime = "";
        });
       },




       findByPage(){
 axios
        .post(
          "//localhost:8082/Supplierreconciliation/SupplierreconciliationPage?documentNumber=" +
            this.documentNumber +
            "&productName=" +
            this.productName +
            "&time=" +
            this.begintime +
            "&pageSize=" +
            this.pageSize +
            "&pageCurrent=" +
            this.pageCurrent
        )
        .then(res => {
          console.log("13123123123213")
          console.log(res.data);
          this.dataCount = res.data.countTotal;
          this.data1 = res.data.list;
         
          //当从数据库获取完毕  关闭加载特效
          this.spinShow=false;
          // this.begintime = "";
        });
       },
                  // 重置
    resetForm() {
      this.documentNumber = "";
      this.begintime = [];
      this.productName = "";
    },
   }
}
</script>
